<template>
  <div class="box">
    <div class="top">
      <p class="title">到校学生统计</p>
      <p class="bg"></p>
      <p class="right">可接纳学生总量：<span>99999 </span>人</p>
    </div>
    <div class="number">
      <span v-for="(item, index) in people" :key="index">{{ item }}</span>
    </div>
    <!-- 盒子将来 e-charts 展示图形图表的节点 -->
    <div class="charts" ref="charts"></div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
// 引入 echarts 类库
import * as echarts from 'echarts'
// 引入水球图拓展插件
import 'echarts-liquidfill'
const people = ref('021126人')
// 获取 echarts 节点
const charts = ref()
onMounted(() => {
  // 获取 echarts 类的实例
  const mycharts = echarts.init(charts.value)
  // 设置图表实例的配置项
  mycharts.setOption({
    // 标题组件
    title: {
      text: '',
      
    },
    // x 或 y 轴组件
    // xAxis: {},
    // yAxis: {},
    // 系列：决定想要什么样的图形图表
    series: {
      type: 'liquidFill',  // 系统
      data: [0.61, 0.4, 0.2],  // 展示的数据波动
      waveAnimation: true,  // 动画
      animationDuration: 3,
      animationDurationUpdate: 0,
      radius: '100%',  // 半径
      outline: {//外层边框颜色设置
        show: true,
        borderDistance: 8,
        itemStyle: {
          color: 'skyblue',
          borderColor: '#294D99',
          borderWidth: 8,
          shadowBlur: 20,
          shadowColor: 'rgba(0, 0, 0, 0.25)'
        }
      },
      //布局组件
      grid: {
        left: 0,
        right: 0,
        top: 0,
        bottom: 0
      }
      
    }
  })
})
</script>

<style scoped lang="scss">
.box {
  background: url(../../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;
  margin-top:20px;

  .top {
    margin-left: 20px;

    .title {
      color: white;
      font-size: 20px;
    }

    .bg {
      width: 68px;
      height: 7px;
      background: url(../../images/dataScreen-title.png) no-repeat;
      background-size: 100% 100%;
      margin-top: 10px;
    }

    .right {
      float: right;
      color: white;
      font-size: 20px;

      span {
        color: yellow;
      }
    }
  }

  .number {
    padding: 10px 20px;
    margin-top: 30px;
    display: flex;

    span {
      flex: 1;
      height: 40px;
      line-height: 40px;
      text-align: center;
      background: url(../../images/total.png) no-repeat;
      background-size: 100% 100%;
      color: #29fcff;
      font-size: large;
      font-weight: bold;
    }
  }

  .charts {
    width: 100%;
    height: 250px;
  }
}
</style>